package com.hand.wfive.view.dialog;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.lxj.xpopup.impl.FullScreenPopupView;
import com.hand.wfive.R;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class UpLoadSelectView extends FullScreenPopupView {
    private OnSelectCallBack onSelectCallBack;

    public UpLoadSelectView(@NonNull Context context, OnSelectCallBack onSelectCallBack) {
        super(context);
        this.onSelectCallBack = onSelectCallBack;
    }

    public interface OnSelectCallBack {
        void call(int position);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_file_select;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        ButterKnife.bind(this);

    }

    @OnClick({R.id.iv_upload_image, R.id.iv_upload_word, R.id.iv_upload_pdf,R.id.iv_close_select_file,R.id.rl_root})
    public void OnClick(View view) {
        switch (view.getId()) {
            case R.id.iv_upload_image: {
                if (onSelectCallBack != null)
                    onSelectCallBack.call(1);
            }
            break;
            case R.id.iv_upload_word: {
                if (onSelectCallBack != null)
                    onSelectCallBack.call(2);

            }
            break;
            case R.id.iv_upload_pdf: {
                if (onSelectCallBack != null)
                    onSelectCallBack.call(3);
            }
            break;
            default:
                dismiss();
        }
        dismiss();
    }

}
